import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 黎鹤舞
 * Date: 2023-11-01
 * Time: 20:25
 */
public class Test {

    //根据输入的年龄判断是 少年(低于18), 青年(19-28), 中年(29-55), 老年(56以上)
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()) {
            int num = scanner.nextInt();
            if(num < 19) {
                System.out.println("这是少年");
            } else if (num >= 19 && num <= 28) {
                System.out.println("这是青年人");
            } else if (num >= 29 && num <= 55) {
                System.out.println("这是中年人");
            }else {
                System.out.println("这是老年人");
            }
        }
        scanner.close();
    }

    //猜数字游戏
    public static void main6(String[] args) {

        //new一个random工具
        Random random = new Random();
        int randNum = random.nextInt(100);

        Scanner scanner = new Scanner(System.in);

        while(true) {

            System.out.println("请输入你猜测的数字:");
            int num = scanner.nextInt();

            if(num < randNum) {
                System.out.println("猜小了");
            }else if(num > randNum) {
                System.out.println("猜大了");
            }else {
                System.out.println("恭喜你猜对了！！！！");
                break;
            }
        }
        scanner.close();
    }

    //循环输入的测试
    public static void main4(String[] args) {
        //先通过Scanner
        Scanner scanner = new Scanner(System.in);
        int sum = 0;
        //如果还有int类型数据，就进行循环
        while(scanner.hasNextInt()) {
            sum += scanner.nextInt();
        }
        System.out.println(sum);
    }

    //输入输出的测试
    public static void main3(String[] args) {
        int a = 10;
        System.out.printf("%d\n",a);

        System.out.println("请输入你的姓名:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("好的，李航baby");

        System.out.println("请输入你的学号:");
        String stuNum = scanner.next();
        System.out.println(stuNum);

        scanner.close();
    }

    //continue的练习
    public static void main2(String[] args) {
        int i = 0;
        while(i <= 100) {
            i++;
            if(i % 3 == 0  && i %5 == 0) {
                System.out.println(i);
                continue;
            }
        }

    }


    public static void main1(String[] args) {
        int i = 0;
        while(i <= 10) {
            if(i == 3) {
                System.out.println("结束循环！");
                break;
            }
            i++;
        }
    }
}
